package com.sky.migrate.common;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource {

    @Value("${db-migrate.key}")
    private String key;

    @Override
    protected Object determineCurrentLookupKey() {
        return DataSourceType.Type.valueOf(StringUtils.upperCase(key));
    }
}
